gitfandomcom-20200214-history
Cvs to git
= have some fun converting cvs to git = ic_common create a tar.gz on the CVS server which we will import to git tar czvf 2009_07_24-ic_common-cooked.for.git.tar.gz /usr/local/cvs/ic_common-cooked_for_git/ copy it over to the server which hosts the git repository I was creating 2 users/groups integration/integration framework/framework --------------- as integration: cd /home/integration mkdir from_cvs untar ic_common and CVSROOT one directory level above it (we need CVSROOT) like this hopefully there will be no CVSROOT directory under ic_common We will end up with someting like this: /usr/home/integration/CVSROOT /usr/home/integration/from_cvs/ic_common /usr/home/integration/from_cvs/phoneme-advanced Note: cvs2svn searches for CVSROOT in it's folder or the one above it so I created /usr/home/integration/CVSROOT mkdir /usr/home/integration/ic_common-to-git cd ic_common-to-git cp /usr/ports/devel/cvs2svn/work/cvs2svn-2.2.0/cvs2svn-example.options . cp /usr/ports/devel/cvs2svn/work/cvs2svn-2.2.0/test-data/main-cvsrepos/cvs2svn-git.options . some cleanup remove some video streams which made it into version control rm -f /usr/home/integration/from_cvs/ic_common/src/ic_filePlayer/streams/Attic/Shrek.ts,v rm -f /usr/home/integration/from_cvs/ic_common/src/ic_filePlayer/streams/Attic/bloomberg.ps,v rm -f /usr/home/integration/from_cvs/ic_common/src/ic_filePlayer/streams/Attic/test1_mpeg,v rm -f /usr/home/integration/from_cvs/ic_common/src/ic_filePlayer/streams/Attic/test2_mpeg,v rm -f /usr/home/integration/from_cvs/ic_common/src/ic_filePlayer/streams/Attic/test_system,v remove some files which will prevent us from converting to git otherwise we'll fail later and will have to remove them later rm -f /usr/home/integration/from_cvs/ic_common/src/ic_drv/Attic/ic_drv_md_ppcstb04500_linux.c,v rm -f /usr/home/integration/from_cvs/ic_common/src/ic_drv/Attic/ic_drv_md_sti5514_vxworks.c,v rm -f /usr/home/integration/from_cvs/ic_common/src/ic_drv/Attic/ic_drv_md_sti5514_vxworks.h,v rm -f /usr/home/integration/from_cvs/ic_common/src/ic_drv/Attic/ic_drv_md_x86_linux.c,v fix the permissions for ic_common git tracks also permissions, so we need to put in the right permissions cd /usr/home/integration/from_cvs chmod -R 644 ic_common cd /usr/home/integration/from_cvs/ic_common find . -name "*.sh,v" -exec chmod 755 {} \; find . -name "*.pl,v" -exec chmod 755 {} \; add .gitignore with "old" tags cat .gitignore,v head 1.1; access; symbols R194d:1.1 R194c:1.1 C_R194:1.1.0.70 B_R194:1.1.0.68 D194+:1.1 R186c:1.1 c_R186:1.1.0.66 R194b:1.1.0.64 R194:1.1 R193:1.1 R192:1.1 R191:1.1 R186b2:1.1.0.62 R186b:1.1.0.60 b_R186:1.1.0.58 R190:1.1 R189:1.1 R188:1.1 D187:1.1 b_R_081003_172:1.1.0.56 R179_d:1.1 R186:1.1 R185:1.1 R179_c:1.1 R184:1.1 T_090910:1.1 T_090909b:1.1 branch_T_090909:1.1.0.54 T_090909:1.1 R183:1.1 R179b:1.1 R179_b:1.1 b_R179:1.1.0.52 R181:1.1 R180:1.1 R179:1.1 R178:1.1 R176:1.1 R175:1.1 R174:1.1 R_081020_173:1.1 R_081003_172:1.1 R_081003_171:1.1 test:1.1 R_080929_170:1.1 b125_R_080919_169:1.1.0.50 R_080919_169:1.1 b125_R_080918_168:1.1.0.48 R_080918_168:1.1 b125_R_080912_167:1.1.0.46 R_080912_167:1.1 b125_R_080909_166:1.1.0.44 R_080909_166:1.1 b125_D_080905_165:1.1.0.42 D_080905_165:1.1 b125_D_080902_164:1.1.0.40 D_080902_164:1.1 b125_D_080821_163:1.1.0.38 D_080821_163:1.1 b125_D_080801_162:1.1.0.36 D_080801_162:1.1 b125_R_080725_161:1.1.0.34 R_080725_161:1.1 b125_R_080725_162:1.1.0.32 branch125_R_080716_160:1.1.0.30 R_080716_160:1.1 branch125_T_080710_000:1.1.0.28 R_080704_159_b125:1.1 b125_R_080704_159:1.1.0.26 R_080704_159:1.1 R_080627_158:1.1 R_080625_157:1.1 T_080624_5:1.1 test_branch_146:1.1.0.24 T_080624_3:1.1 T_080624_2:1.1 T_080624:1.1 R_080624_146:1.1 branch_146:1.1.0.22 R_080613_156:1.1 R_080611_155:1.1 D_080606_142:1.1 R_080606_154:1.1 branch_142:1.1.0.20 R_080605_153:1.1 R_080605:1.1 R_080522_152:1.1 R_080522_151:1.1 R_080422_150:1.1 R_080415_149:1.1 R_080414_148:1.1 R_080408_147:1.1 before_multi_instance:1.1.0.18 R_080303_146:1.1 V_FOR_0:1.1 R_080123_142_DHP_NEW:1.1.0.16 auto_try:1.1 test_tag:1.1 V_145:1.1 V_144:1.1 TIME_SHIFT_ZERO_HOUR:1.1 R_080124_143:1.1 R_080123_142:1.1 R_080123_141:1.1 R_080111_140:1.1 branch_139:1.1.0.14 R_071219_139:1.1 R_071217_138:1.1 R_071213_137:1.1 R_071210_136:1.1 R_071115_135:1.1 R_071115_134:1.1 D_071114_133:1.1 R_071029_132:1.1 R_071024_131:1.1 D_071024_130:1.1 V_071019:1.1.0.12 R_071016_129:1.1 R_071009_128:1.1 D_071008_127:1.1 D_070924_126:1.1 R_070919_125:1.1 D_070912_124:1.1 R_070911_123:1.1 R_070910_122:1.1 D_070906_121:1.1 D_070904_120:1.1 D_070829_119:1.1 D_070829_118:1.1 D_070827_117:1.1 R_070727_116:1.1 D_070724_115:1.1 R_070719_114:1.1 R_070717_113:1.1 R_070706_112:1.1 R_070704_111:1.1 R_070703_110:1.1 R_070629_109:1.1 R_070622_108:1.1 D_070621_107:1.1 R_070612_106:1.1 R_070525_105:1.1 R_070525_104:1.1 R_070524_103:1.1 R_070509_102:1.1 D_070502_101:1.1 D_070419_100:1.1 R_070413_099:1.1 D_070411_098:1.1 D_070320_097:1.1 D_070319_097:1.1 D_070319_096:1.1 R_070309_095:1.1 R_070308_094:1.1 R_070308_093:1.1 R_070307_092:1.1 R_070305_091:1.1 R_070305_91:1.1 R_070215_090:1.1 R_070214_089:1.1 R_070209_088:1.1 R_070205_087:1.1 R_070205_086:1.1 D_070202_085:1.1 D_070201_084:1.1 D_070131_083:1.1 D_070130_082:1.1 D_070129_081:1.1 R_070122_080:1.1 D_070115_079:1.1 D_070111_078:1.1 R_070110_077:1.1 D_070109_076:1.1 R_061219_075_UDP:1.1 UDP_75:1.1.0.10 R_061219_075:1.1 R_061214_073_UDP:1.1 UDP_73:1.1.0.8 R_061214_072_UDP:1.1 UDP_72:1.1.0.6 R_061214_074_UDP:1.1 R_061212_074_UDP:1.1.0.4 R_061208_073_UDP:1.1 R_061204_072_UDP:1.1 R_061212_074:1.1 R_061208_073:1.1 R_061204_072:1.1 D_061109_071_UDP:1.1 D_061109_071:1.1 R_061026_070:1.1 D_061017_069:1.1 D_061013_068:1.1 D_060921_067:1.1 D_060914_066:1.1 R_060720_065:1.1 R_060718_UDP:1.1 UDP:1.1.0.2 D_060710_064:1.1 D_060704_063:1.1 R_060703_062:1.1 D_060630_061:1.1 R_060626_060:1.1 D_060621_059:1.1 R_060608_058:1.1 R_060601_057:1.1 R_060529_056:1.1 R_060522_055:1.1 R_060510_054:1.1 D_060406_053:1.1 D_060329_052:1.1 D_060320_051:1.1 D_060309_050:1.1 D_060224_049:1.1 D_060222_048:1.1 D_060210_047:1.1 D_060206_046:1.1 R_060201_045:1.1 D_060131_044:1.1 D_060130_043:1.1 capitalize_it:1.1; locks; strict; comment @# @; expand @v@; 1.1 date 2003.09.05.12.59.48; author cvsrber; state Exp; branches; next ; desc @@ 1.1 log @prepare CVS repository for transition to git @ text @objs logs lib @ some cooking related to ic_common_ver.c * added and back-tagged ** .gitignore ** bin/setlocalversion ** src/ic_common_ver/find_tag.sh * modified and back-tagged ** src/ic_common_ver/ic_common_ver.c ** src/ic_common_ver/makefile What happens now is, that both from cvs and git the ic_common_ver makefile calls a script (which fails without git), but in case of cvs $Name$ is expanded to a tag (which expands to nothing for git) Like this we should have something which works both for cvs and git (although we are going to dump cvs soon) cvs2svn-git.options You then need to edit the cvs2svn-git.options file. Change the path to the CVS repository (look near run_options.add_project). replaced r'test-data/main-cvsrepos' with r'/usr/home/integration/from_cvs/ic_common' you can also add various authors like this under author_transforms={ 'rber' : ('Robert Berger', 'rber@work.com'), 'amou' : ('Apostolos Moutiakas', 'amou@work.com'), } in cvs2svn-example.options Make sure you remove the comment character before the fallback_encoding lines. Otherwise the log message conversion will fail because it can't convert all commit messages to ASCII. I also removed the comment character before the utf8 string, just above fallback_encoding because some of the FreeBSD commit messages were in UTF83. 3 places to change in cvs2svn-example.options above. replace: # How to convert author names, log messages, and filenames to unicode. # The first argument to CVSTextDecoder is a list of encoders that are # tried in order in 'strict' mode until one of them succeeds. If none # of those succeeds, then fallback_encoder is used in lossy 'replace' # mode (if it is specified). Setting a fallback encoder ensures that # the encoder always succeeds, but it can cause information loss. ctx.cvs_author_decoder = CVSTextDecoder( [ #'latin1', #'utf8', 'ascii', ], #fallback_encoding='ascii' ) with: ctx.cvs_author_decoder = CVSTextDecoder( [ #'latin1', 'utf8', 'ascii', ], fallback_encoding='ascii' ) replace: ctx.cvs_log_decoder = CVSTextDecoder( [ #'latin1', #'utf8', 'ascii', ], #fallback_encoding='ascii' ) with: ctx.cvs_log_decoder = CVSTextDecoder( [ #'latin1', 'utf8', 'ascii', ], fallback_encoding='ascii' ) replace: # You might want to be especially strict when converting filenames to # unicode (e.g., maybe not specify a fallback_encoding). ctx.cvs_filename_decoder = CVSTextDecoder( [ #'latin1', #'utf8', 'ascii', ], #fallback_encoding='ascii' ) with: # You might want to be especially strict when converting filenames to # unicode (e.g., maybe not specify a fallback_encoding). ctx.cvs_filename_decoder = CVSTextDecoder( [ #'latin1', 'utf8', 'ascii', ], fallback_encoding='ascii' ) replace: # Create the default project (using ctx.trunk, ctx.branches, and ctx.tags): run_options.add_project( r'test-data/main-cvsrepos', trunk_path='trunk', with: # Create the default project (using ctx.trunk, ctx.branches, and ctx.tags): run_options.add_project( r'/usr/home/integration/from_cvs/ic_common', trunk_path='trunk', run the *ucker screen bash cd /usr/home/integration/ic_common-to-git time cvs2svn --options=cvs2svn-git.options Pass 1 complete. Error summary: ERROR: A CVS repository cannot contain both /usr/home/integration/from_cvs/ic_common/src/ic_drv/ic_drv_md_ppcstb04500_linux.c,v and /usr/home/integration/from_cvs/ic_common/src/ic_drv/Attic/ic_drv_md_ppcstb04500_linux.c,v ERROR: A CVS repository cannot contain both /usr/home/integration/from_cvs/ic_common/src/ic_drv/ic_drv_md_sti5514_vxworks.c,v and /usr/home/integration/from_cvs/ic_common/src/ic_drv/Attic/ic_drv_md_sti5514_vxworks.c,v ERROR: A CVS repository cannot contain both /usr/home/integration/from_cvs/ic_common/src/ic_drv/ic_drv_md_sti5514_vxworks.h,v and /usr/home/integration/from_cvs/ic_common/src/ic_drv/Attic/ic_drv_md_sti5514_vxworks.h,v ERROR: A CVS repository cannot contain both /usr/home/integration/from_cvs/ic_common/src/ic_drv/ic_drv_md_x86_linux.c,v and /usr/home/integration/from_cvs/ic_common/src/ic_drv/Attic/ic_drv_md_x86_linux.c,v Exited due to fatal error(s). Maybe it would be good to clean out the stuff which created the ERRORS above? Not only maybe, but certainly we have to remove the errors (just erase those files above in Attic folders), otherwise it's not going to work.! create the git repository as root su root cd /usr/home/integration chown -R amou:ic_common_git ic_common-to-git as amou su amou cd /usr/home/integration/ic_common-to-git rm -rf .git git --bare init --shared=group time cat cvs2svn-tmp/git-blob.dat cvs2svn-tmp/git-dump.dat | git fast-import If you want to get rid of unnecessary tag fixup branches, then run the contrib/git-move-tags.py script from within the git repository. (I did not do this) copy created folder over to public repository on the server hosting git: * as owner (amou) copy over from ic_commo-to-git the converted .git to /pub/git/ic_common.git su amou cd /pub/git #cp -R /usr/home/integration/ic_common-to-git/.git/ ic_common.git don't need to copy cvs2svn-tmp (to save space) cp -R /usr/home/integration/ic_common-to-git ic_common.git cd ic_common.git * modify config to look like this: vim config core repositoryformatversion = 0 filemode = true bare = true sharedrepository = 1 phoneme-advanced some cleanup/cooking on the server hosting the CVS repository duplicate the CVS repository phoneme-advanced to phoneme-advanced-cooked_for_git add .gitigore and retag cat .gitignore,v head 1.1; access; symbols R194d:1.1 R194c:1.1 C_R194:1.1.0.56 B_R194:1.1.0.54 D194+:1.1 R186c:1.1 c_R186:1.1.0.52 R194b:1.1.0.50 194:1.1 R193:1.1 R192:1.1 R191:1.1 R186b2:1.1.0.48 R186b:1.1.0.46 b_R186:1.1.0.44 R190:1.1 R189:1.1 R188:1.1 D187:1.1 b_R_081003_172:1.1.0.42 R179_d:1.1 R186:1.1 R185:1.1 R179_c:1.1 R184:1.1 T_090909:1.1 R183:1.1 R179_b:1.1 b_R179:1.1.0.40 R181:1.1 R180:1.1 R179:1.1 R178:1.1 R176:1.1 R175:1.1 R174:1.1 R_081020_173:1.1 R_081003_172:1.1 R_081003_171:1.1 test:1.1 R_080929_170:1.1 b125_R_080919_169:1.1.0.38 R_080919_169:1.1 b125_R_080918_168:1.1.0.36 R_080918_168:1.1 b125_R_080912_167:1.1.0.34 R_080912_167:1.1 b125_R_080909_166:1.1.0.32 R_080909_166:1.1 b125_D_080905_165:1.1.0.30 D_080905_165:1.1 b125_D_080902_164:1.1.0.28 D_080902_164:1.1 b125_D_080821_163:1.1.0.26 D_080821_163:1.1 b125_D_080801_162:1.1.0.24 D_080801_162:1.1 b125_R_080725_161:1.1.0.22 R_080725_161:1.1 b125_R_080725_162:1.1.0.20 branch125_R_080716_160:1.1.0.18 R_080716_160:1.1 branch125_T_080710_000:1.1.0.16 R_080704_159_b125:1.1 b125_R_080704_159:1.1.0.14 R_080704_159:1.1 R_080627_158:1.1 R_080625_157:1.1 T_080624_2:1.1 R_080624_146:1.1 T_080624:1.1 branch_146:1.1.0.12 R_080613_156:1.1 R_080611_155:1.1 D_080606_142:1.1 R_080606_154:1.1 branch_142:1.1.0.10 R_080605_153:1.1 R_080605:1.1 R_080522_152:1.1 R_080522_151:1.1 R_080422_150:1.1 R_080415_149:1.1 R_080414_148:1.1 R_080408_147:1.1 before_multi_instance:1.1.0.8 R_080303_146:1.1 V_FOR_0:1.1 R_080123_142_DHP_NEW:1.1.0.6 auto_try:1.1 test_tag:1.1 V_145:1.1 V_144:1.1 TIME_SHIFT_ZERO_HOUR:1.1 R_080124_143:1.1 R_080123_142:1.1 R_080123_141:1.1 R_080111_140:1.1 branch_139:1.1.0.4 R_071219_139:1.1 R_071217_138:1.1 R_071213_137:1.1 R_071210_136:1.1 R_071115_135:1.1 R_071115_134:1.1 R_071029_132:1.1 R_071024_131:1.1 V_071019:1.1.0.2 R_071016_129:1.1 R_071009_128:1.1 D_071008_127:1.1 D_070924_126:1.1 R_070919_125:1.1 D_070912_124:1.1 R_070911_123:1.1 R_070910_122:1.1 D_070906_121:1.1 D_070904_120:1.1 D_070829_119:1.1 D_070829_118:1.1 D_070827_117:1.1 R_070727_116:1.1 D_070724_115:1.1 R_070719_114:1.1 R_070706_112:1.1 R_070704_111:1.1 R_070703_110:1.1 R_070629_109:1.1 R_070622_108:1.1 R_070612_106:1.1 mr2-x86-mips-powerpc-working:1.1 icom:1.1; locks; strict; comment @# @; 1.1 date 2007.06.07.09.06.40; author cvsrber; state Exp; branches; next ; desc @@ 1.1 log @prepare phoneme-advanced for git @ text @tools/output build/*/democlasses/ build/*/.* build/*/cvm_objs/ build/*/bin build/*/btclasses.zip build/*/btclasses/ build/*/classes.jcc/ build/*/classes.tools/ build/*/democlasses.jar build/*/generated/ build/*/lib/ build/*/obj/ build/*/testclasses.zip build/*/testclasses/ build/*/zic_classes/ git_info.h @ remove some files find . -name ".svn" -exec rm -rf {} \; fix some permissions find . -name "*.sh,v" -exec chmod 755 {} \; find . -name "*.c,v" -exec chmod 644 {} \; find . -name "*.h,v" -exec chmod 644 {} \; find . -name "*.java,v" -exec chmod 644 {} \; cd build find . -name "*build*" -exec chmod 755 {} \; create a tar.gz on the CVS server which we will import to git tar czvf 2009_07_27-phoneme-advanced-cooked.for.git.tar.gz /usr/local/cvs/phoneme-advanced-cooked_for_git/ copy it over to the server which hosts the git repository cd /home/integration mkdir from_cvs untar phoneme-advanced and CVSROOT one directory level above it (we need CVSROOT) like this hopefully there will be no CVSROOT directory under ic_common We will end up with someting like this: /usr/home/integration/CVSROOT /usr/home/integration/from_cvs/ic_common /usr/home/integration/from_cvs/phoneme-advanced Note: cvs2svn searches for CVSROOT in it's folder or the one above it so I created /usr/home/integration/CVSROOT mkdir /usr/home/integration/phoneme-to-git cd phoneme-to-git cp /usr/ports/devel/cvs2svn/work/cvs2svn-2.2.0/cvs2svn-example.options . cp /usr/ports/devel/cvs2svn/work/cvs2svn-2.2.0/test-data/main-cvsrepos/cvs2svn-git.options . some cooking related to ic_jvm_ver.c * added and back-tagged ** .gitignore ** /tools/gittools/setlocalversion ** /tools/gittools/find_tag.sh * modified and back-tagged ** build/linux/defs_cdc.mk ** src/linux/native/com/sun/kjava/ic_jvm_ver.c ** rules.mk (to call script from clean) You need to know, that the standard build script always calls make clean first. What happens now is, that both from cvs and git the clean target (in rules.mk) calls a script (which fails without git), but in case of cvs $Name$ is expanded to a tag (which expands to nothing for git) Like this we should have something which works both for cvs and git (although we are going to dump cvs soon) cvs2svn-git.options You then need to edit the cvs2svn-git.options file. Change the path to the CVS repository (look near run_options.add_project). replaced r'test-data/main-cvsrepos' with r'/usr/home/integration/from_cvs/phoneme-advanced' you can also add various authors like this under author_transforms={ 'rber' : ('Robert Berger', 'rber@work.com'), 'amou' : ('Apostolos Moutiakas', 'amou@work.com'), } in cvs2svn-example.options Make sure you remove the comment character before the fallback_encoding lines. Otherwise the log message conversion will fail because it can't convert all commit messages to ASCII. I also removed the comment character before the utf8 string, just above fallback_encoding because some of the FreeBSD commit messages were in UTF83. 3 places to change in cvs2svn-example.options above. replace: # How to convert author names, log messages, and filenames to unicode. # The first argument to CVSTextDecoder is a list of encoders that are # tried in order in 'strict' mode until one of them succeeds. If none # of those succeeds, then fallback_encoder is used in lossy 'replace' # mode (if it is specified). Setting a fallback encoder ensures that # the encoder always succeeds, but it can cause information loss. ctx.cvs_author_decoder = CVSTextDecoder( [ #'latin1', #'utf8', 'ascii', ], #fallback_encoding='ascii' ) with: ctx.cvs_author_decoder = CVSTextDecoder( [ #'latin1', 'utf8', 'ascii', ], fallback_encoding='ascii' ) replace: ctx.cvs_log_decoder = CVSTextDecoder( [ #'latin1', #'utf8', 'ascii', ], #fallback_encoding='ascii' ) with: ctx.cvs_log_decoder = CVSTextDecoder( [ #'latin1', 'utf8', 'ascii', ], fallback_encoding='ascii' ) replace: # You might want to be especially strict when converting filenames to # unicode (e.g., maybe not specify a fallback_encoding). ctx.cvs_filename_decoder = CVSTextDecoder( [ #'latin1', #'utf8', 'ascii', ], #fallback_encoding='ascii' ) with: # You might want to be especially strict when converting filenames to # unicode (e.g., maybe not specify a fallback_encoding). ctx.cvs_filename_decoder = CVSTextDecoder( [ #'latin1', 'utf8', 'ascii', ], fallback_encoding='ascii' ) replace: # Create the default project (using ctx.trunk, ctx.branches, and ctx.tags): run_options.add_project( r'test-data/main-cvsrepos', trunk_path='trunk', with: # Create the default project (using ctx.trunk, ctx.branches, and ctx.tags): run_options.add_project( r'/usr/home/integration/from_cvs/phoneme-advanced', trunk_path='trunk', run the *ucker screen bash cd /usr/home/integration/phoneme-to-git time cvs2svn --options=cvs2svn-git.options create the git repository as root su root cd /usr/home/integration chown -R amou:phoneme_git phoneme-to-git as amou su amou cd /usr/home/integration/phoneme-to-git rm -rf .git git --bare init --shared=group time cat cvs2svn-tmp/git-blob.dat cvs2svn-tmp/git-dump.dat | git fast-import If you want to get rid of unnecessary tag fixup branches, then run the contrib/git-move-tags.py script from within the git repository. (I did not do this) copy created folder over to public repository on the server hosting git: * as owner (amou) copy over from phoneme-to-git the converted .git to /pub/git/phoneme-advanced.git su amou cd /pub/git #cp -R /usr/home/integration/phoneme-to-git/.git/ phoneme.git don't need to copy cvs2svn-tmp (to save space) cp -R /usr/home/integration/phoneme-to-git phoneme-advanced.git cd phoneme-advanced.git * modify config to look like this: vim config core repositoryformatversion = 0 filemode = true bare = true sharedrepository = 1